package org.csmzxy.class2333;

//游泳接口
interface Swim{
    void swimming();
}

public class Example18 {
    public static void main(String[] args) {
        String name = "小明";
        //使用匿名内部类1
        new Swim() {
            @Override
            public void swimming() {
                System.out.println(name + "学会了自由泳……");
            }
        }.swimming();
        //使用匿名内部类2
        new Swim(){
            @Override
            public void swimming(){
                System.out.println(name + "学会了蛙泳……");
            }
        }.swimming();
    }
}
